package com.business.corp;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.ConvertUtils;

import com.frame.struts.ActionContext;
import com.frame.struts.BaseBean;
import com.utils.CommUtil;
import com.utils.DateConverter;

public class HbjlForm extends BaseBean
{
    public HbjlForm()
    {
    }
    
    static{
        ConvertUtils.register(new DateConverter(), Date.class);
    }

    HbjlEntity HbjlEntity = new HbjlEntity();
    private String oldId="";

    public String addHbjl()
    {
        if( logger.isDebugEnabled() )
        {
            logger.debug( "enter addHbjl()" );
        }
        HttpServletRequest request = ActionContext.getActionContext()
                                                  .getRequest();
        HttpServletResponse response = ActionContext.getActionContext()
                                                    .getResponse();
        NewCorpFactory factory = NewCorpFactory.getInstance();
        String qyid = (String) request.getSession()
                                      .getAttribute( "session_qyid" );
        HbjlEntity.setQyid( qyid );
        HbjlEntity.setOptdate( new Date() );
        HbjlEntity.setOptrid( CommUtil.getUserId( request ) );
        HbjlEntity.setXh( NewCorpFactory.getNextXh( "qy_hbjl", qyid ) );
        try
        {
            if( factory.addHbjl( HbjlEntity ) )
            {
                System.out.println( "Enter addHbjl()" );
                response.sendRedirect( "/corp/queryhbjl.jsp" );
            }else{
                response.sendRedirect( "/failed.jsp" );
            }
        }
        catch( Exception e )
        {
        }
        return null;

    }

    public String editHbjl()
    {
        if( logger.isDebugEnabled() )
        {
            logger.debug( "enter addHbjl()" );
        }
        HttpServletRequest request = ActionContext.getActionContext()
                                                  .getRequest();
        HttpServletResponse response = ActionContext.getActionContext()
                                                    .getResponse();
        NewCorpFactory factory = NewCorpFactory.getInstance();
        String qyid = (String) request.getSession()
                                      .getAttribute( "session_qyid" );
        HbjlEntity.setQyid( qyid );
        HbjlEntity.setOptdate( new Date() );
        HbjlEntity.setOptrid( CommUtil.getUserId( request ) );
        factory.delHbjl(qyid,HbjlEntity.getXh());
        try
        {
            if( factory.addHbjl( HbjlEntity ) )
            {
                System.out.println( "Enter editHbjl()" );
                response.sendRedirect( "/corp/queryhbjl.jsp" );
            }else{
                response.sendRedirect( "/failed.jsp" );
            }
        }
        catch( Exception e )
        {
            e.printStackTrace();
        }
        return null;
    }
	
    public String getQyid() {
		return HbjlEntity.getQyid();
	}
	public void setQyid(String qyid) {
		HbjlEntity.setQyid(qyid);
	}
	public int getXh() {
		return HbjlEntity.getXh();
	}
	public void setXh(int xh) {
		HbjlEntity.setXh(xh);
	}
	public String getJfjl() {
		return HbjlEntity.getJfjl();
	}
	public void setJfjl(String jfjl) {
		HbjlEntity.setJfjl(jfjl);
	}
	public String getRzdw() {
		return HbjlEntity.getRzdw();
	}
	public void setRzdw(String rzdw) {
		HbjlEntity.setRzdw(rzdw);
	}
	public String getRzbz() {
		return HbjlEntity.getRzbz();
	}
	public void setRzbz(String rzbz) {
		HbjlEntity.setRzbz(rzbz);
	}
	public String getZsbh() {
		return HbjlEntity.getZsbh();
	}
	public void setZsbh(String zsbh) {
		HbjlEntity.setZsbh(zsbh);
	}
	public String getSffhhb() {
		return HbjlEntity.getSffhhb();
	}
	public void setSffhhb(String sffhhb) {
		HbjlEntity.setSffhhb(sffhhb);
	}
		public String getSftgrz() {
		return HbjlEntity.getSftgrz();
	}
	public void setSftgrz(String sftgrz) {
		HbjlEntity.setSftgrz(sftgrz);
	}
	public String getYxq() {
		return HbjlEntity.getYxq();
	}
	public void setYxq(String yxq) {
		HbjlEntity.setYxq(yxq);
	}
	public String getOptrid() {
		return HbjlEntity.getOptrid();
	}
	public void setOptrid(String optrid) {
		HbjlEntity.setOptrid(optrid);
	}
	public Date getOptdate() {
		return HbjlEntity.getOptdate();
	}
	public void setOptdate(Date optdate) {
		HbjlEntity.setOptdate(optdate);
	}
	public String getRecstate() {
		return HbjlEntity.getRecstate();
	}
	public void setRecstate(String recstate) {
		HbjlEntity.setRecstate(recstate);
	}
	public String getRemark() {
		return HbjlEntity.getRemark();
	}
	public void setRemark(String remark) {
		HbjlEntity.setRemark(remark);
	}
   

}
